package top.igotcha.eduservice.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;
import top.igotcha.eduservice.entity.subject.OneSubject;
import top.igotcha.eduservice.service.EduSubjectService;
import top.igotcha.commonutils.utils.R;

import java.util.List;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author Gotcha
 * @since 2021-08-05
 */
@RestController
@RequestMapping("/eduservice/edusubject")
//@CrossOrigin
public class EduSubjectController {
    @Autowired
    private EduSubjectService subjectService;

    @PostMapping("")
    public R addsubject(MultipartFile file){
        subjectService.saveSubject(file,subjectService);
        return R.OK();
    }

    @GetMapping("")
    public R getAllSubject(){
        List<OneSubject> list  = subjectService.getAllOneTwoSubject();
        return R.OK().data("list",list);
    }

}

